/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ar.edu.unicen.twitter.suggest.backend.datasources.dao;

import ar.edu.unicen.twitter.suggest.backend.datasources.dao.util.CustomHibernateDaoSupport;
import ar.edu.unicen.twitter.suggest.backend.dtos.RecommendationReport;
import ar.edu.unicen.twitter.suggest.backend.dtos.UsuarioApi;
import ar.edu.unicen.twitter.suggest.backend.dtos.UsuarioBasico;

/**
 *
 * @author Alex
 */
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

@Repository("reportDao")
public class ReportDaoImpl extends CustomHibernateDaoSupport implements ReportDao {

    private final static Logger LOGGER = Logger.getLogger(ReportDaoImpl.class.getName()); 
    
    public ReportDaoImpl(){
    }
   
    @Override
    @Transactional
    public RecommendationReport getReport(long id) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    @Transactional
    public void update(RecommendationReport r) {
        getSession().saveOrUpdate(r);
//        RecommendationReport result = (RecommendationReport) getSession().get(RecommendationReport.class, r.getId());
//        if (result == null) {
//            getSession().saveOrUpdate(r);
//        } else {
//            getSession().merge(r);
//        }
    }

    @Override
    @Transactional
    public void update(List<RecommendationReport> reports) {
        for(RecommendationReport report:reports)
            update(report);
    }
}